<script setup lang='ts'>
import { ref } from 'vue'
type Todo = {
  id: number
  title: string
  finished: boolean
}
type Todo1 = {
  id: string
  name: string
  price: number
}

// 1. ref函数加类型
const todoList = ref<Todo[]>([
  { id: 1, title: '踢足球', finished: true },
  { id: 2, title: '敲代码', finished: false },
  { id: 3, title: '打篮球', finished: true },
])
const todoList1 = ref<Todo1[]>([
  { id: '1001', name: '男士鞋子', price: 280 },
  { id: '1002', name: '男士卫衣', price: 180 },
])
</script>

<template>
  <div>
    <ul>
      <li v-for="item in todoList" :key="item.id">
        序号：{{ item.id }}，任务：{{ item.title }}，完成情况：{{ item.finished ? '完成' : '未完成' }}
      </li>
      <li v-for="item in todoList1" :key="item.id">
        商品序号：{{ item.id }}，商品名称：{{ item.name }}，商品价格：{{ item.price }}
      </li>
    </ul>
  </div>
</template>

<style scoped></style>
